/*
 * @Author: c
 * @Date: 2024-01-08 17:35:47
 * @LastEditTime: 2024-01-18 23:49:47
 * @LastEditors: c
 * @Description: 
 * @FilePath: \music-web-backend\src\core\music\picture\picture.controller.ts
 * https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Body, Controller, Delete, Get, Param, Patch, Post, Req } from '@nestjs/common';
import { FileDescDto } from 'src/core/system/minio/dto/create-file.dto';
import { CreatePictureDto } from './dto/create-picture.dto';
import { UpdatePictureDto } from './dto/update-picture.dto';
import { PictureService } from './picture.service';

@Controller('picture')
export class PictureController {
  constructor(private readonly pictureService: PictureService) { }

  @Post()
  create(@Body() createPictureDto: CreatePictureDto) {
    return this.pictureService.create(createPictureDto);
  }

  @Get()
  findAll() {
    return this.pictureService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.pictureService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updatePictureDto: UpdatePictureDto) {
    return this.pictureService.update(+id, updatePictureDto);
  }


  /**
* 图片-删除
* @param fileid 
* @param objectName 
* @returns 
*/
  @Delete('deleteFile')
  removePic(@Req() req: Request, @Body() file: FileDescDto) {
    return this.pictureService.deletePic(req, file);
  }

}
